package com.hskn.hss.module.casesetlevel.service.impl;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hskn.hss.exception.HssException;
import com.hskn.hss.module.casesetlevel.entity.CasesetLevel;
import com.hskn.hss.module.casesetlevel.mapper.CasesetLevelMapper;
import com.hskn.hss.module.casesetlevel.service.ICasesetLevelService;
import com.hskn.hss.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author hskn
 * @since 2021-05-18
 */
@Service
public class CasesetLevelServiceImpl extends ServiceImpl<CasesetLevelMapper, CasesetLevel> implements ICasesetLevelService {

    @Resource
    private CasesetLevelMapper casesetLevelMapper;

    @Override
    public void mUpdate(JSONObject params) throws HssException {

        if (StringUtils.isEmpty(params) || StringUtils.isEmpty(params.getString("casesetLevelId"))) {
            throw new HssException("参数错误");
        }
        CasesetLevel casesetLevel = JSON.parseObject(params.toJSONString(), CasesetLevel.class);
        casesetLevelMapper.updateById(casesetLevel);
    }

    @Override
    public List<CasesetLevel> mList(JSONObject params) throws HssException {

        return list();
    }
}
